package com.lph.controller;

import java.util.List;

import javax.annotation.Resource;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import com.lph.model.Menu;
import com.lph.model.Msg;
import com.lph.model.Role;
import com.lph.model.RoleMenu;
import com.lph.service.RoleService;

@Controller
@RequestMapping("/rc")
public class RoleController extends BaseController<Role>{
	@Autowired
	private RoleService rs;
	
	@Override
	public List<Role> find(Role t) {
		return rs.find(t);
	}
	
	@RequestMapping("/role.coc")
	public String index(){
		return "/role/role";
	}
	
	@RequestMapping("/grant.coc")
	@ResponseBody
	public Msg grant(String rid,String mids){
		return rs.grant(rid, mids);
		
	}
	@RequestMapping("/findRoleMenu.coc")
	@ResponseBody
	public List<RoleMenu> findRoleMenu(RoleMenu r){
		
		return rs.findRoleMenu(r);
		
	}
	@RequestMapping("/findRoleMenuRid/{rid}")
	@ResponseBody
	public String findRoleMenuRid(@PathVariable(value="rid") Integer rid){
		
		return rs.findRoleMenuRid(rid);
		
	}
}
